﻿using System;

namespace FDEE.Model
{
    /// <summary>
    /// 标准弯钩
    /// </summary>
    public class MRLCRebarRecord : RebarBase
    {
        //public int A, B,C,D,r,Lx;

        /// <summary>
        /// 标准箍筋
        /// </summary>
        /// <param name="mBarMark"></param>
        /// <param name="sBarMark"></param>
        /// <param name="cBarMark"></param>
        /// <param name="diameter"></param>
        /// <param name="quantity"></param>
        /// <param name="shapeConfig"></param>
        /// <param name="a">内侧距离A</param>
        /// <param name="b">内侧距离B</param>
        /// <param name="rr">内半径，默认为0时，按规范取值</param>
        public MRLCRebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter,
            int quantity,eShapeType shapeConfig,int a, int b, int c, int d, int rr=0):base(mBarMark,sBarMark,cBarMark,diameter,quantity,shapeConfig)
        {
            if(a<0||b<0|| c < 0 || d < 0 || Lx <0)
            {
                throw new Exception("箍筋结果异常请查询原因！");
            }
            A = a;
            B = b;
            C = c;
            D = d;
            this.d = PublicEnumItems.GeteDBData(diameter.ToString());
            if (rr==0)
            {
                r = RebarKnowledge.GetRadiusForSrirrup(diameter);
            }
            else
            {
                r = rr;
            }
          
            this.Formula = "L=A+B+C+D";
        }

        public override void SetLength()
        {
            //Length=(2 * (A + B) + Lx)*0.001;
            Length = Math.Round((A + B+C+D) * 0.001, 3, MidpointRounding.AwayFromZero);
        }
    }

}
